/*
*************************************
* PocketGTT
*************************************
This file is part of PocketGTT.

PocketGTT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

PocketGTT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PocketGTT.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef GTT_STOP_H
#define GTT_STOP_H

#include <QObject>
#include "gtt_line.h"

class GTT_Stop : public QObject
{
    Q_OBJECT


    // correggere la variabile Emtpy (mai modificata)
    // aggiustare anche la funzione di svuotamento fermata
    Q_PROPERTY(bool Empty READ isEmpty /*WRITE setEmpty*/ NOTIFY GTTon_fermata_updated)
    Q_PROPERTY(QString FermataNumero READ getFermataNumero WRITE setFermataNumero NOTIFY GTTon_fermata_updated)
    Q_PROPERTY(QString FermataNome READ getFermataNome WRITE setFermataNome NOTIFY GTTon_fermata_updated)
    Q_PROPERTY(QString FermataIndirizzo READ getFermataIndirizzo WRITE setFermataIndirizzo NOTIFY GTTon_fermata_updated)
    Q_PROPERTY(QList<GTT_Line *> Linee READ getLinee /* WRITE setLinee */ NOTIFY GTTon_fermata_updated)
    Q_PROPERTY(int LineeCount READ getLineeCount /* WRITE setLinee */ NOTIFY GTTon_fermata_updated)
    Q_PROPERTY(QString LineaNumeroByIndex READ getLineaNumeroByIndex NOTIFY GTTon_fermata_updated)
    Q_PROPERTY(bool LineaRealTimeByIndex READ getLineaRealTimeByIndex NOTIFY GTTon_fermata_updated)
    Q_PROPERTY(QString LineaOrarioByIndex READ getLineaOrarioByIndex NOTIFY GTTon_fermata_updated)
    Q_PROPERTY(QList<int> LineaOrarioByIndexNum READ getLineaOrarioByIndexNum NOTIFY GTTon_fermata_updated)
    Q_PROPERTY(bool PositionKnown READ isPositionKnown WRITE setPositionKnown NOTIFY GTTon_fermata_pos_updated)
    Q_PROPERTY(double FermataLat READ getFermataLat WRITE setFermataLat NOTIFY GTTon_fermata_pos_updated)
    Q_PROPERTY(double FermataLng READ getFermataLng WRITE setFermataLng NOTIFY GTTon_fermata_pos_updated)

public:
    explicit GTT_Stop(QObject *parent = 0);

//    Q_INVOKABLE void force_ListViewPassage_flush();

signals:
    // all PROPERTYs NOTIFY signals
    void GTTon_fermata_updated();
    void GTTon_fermata_pos_updated();

public slots:
    void SvuotaFermata();
    void LoadComplete();
    bool isEmpty();

    QString getFermataNumero();
    void setFermataNumero(const QString &stop="291");

    const QString getFermataNome();
    void setFermataNome(const QString &name);

    const QString getFermataIndirizzo();
    void setFermataIndirizzo(const QString &street);

    QList<GTT_Line *> getLinee();
    void addLinea(GTT_Line *line);
    void printLinee();

    int getLineeCount();
    QString getLineaNumeroByIndex(const int id=0);
    QString getLineaOrarioByIndex(const int idL=0, const int id=0);
    QList<int> getLineaOrarioByIndexNum();//const int id=0);
    bool getLineaRealTimeByIndex(const int idL=0, const int idT=0);


    // PROPERTIES for location info functions
    bool isPositionKnown();
    void setPositionKnown(bool pos_ok);
    double getFermataLat();
    void setFermataLat(const double lat=45.0711671);
    double getFermataLng();
    void setFermataLng(const double lng=7.6875669);

private:
    bool hiddenEmpty;
    QString hiddenFermataNumero;
    QString hiddenFermataNome;
    QString hiddenFermataIndirizzo;
    double hiddenFermataLat;
    double hiddenFermataLng;
    bool hiddenPositionKnown;
    QList<GTT_Line *> hiddenLinee;

};

#endif // GTT_STOP_H
